#pragma once

#include <d3d9.h>
#include <d3dx9.h>
#include "Structures.h"
#include "defines.h"

class ISprite
{
private:

protected:

	LPWSTR fileName;
	D3DCOLOR transColor;
	D3DXIMAGE_INFO info;
	LPDIRECT3DDEVICE9 d3ddev;

	// Read image info
	// return 0  = fine; 1 = fail
	int ReadInfo();

public:
	/* Property */

	SpriteInfo spriteInfo;
	

	/* Functions */

	// Check animation time and Goto next animation on the sprite if enough time (step 1)
	// Backward on x.
	void Next(bool);
	
	// Virtual func to load texture or surface on child class. 0 = OK; 1 = FAIL
	virtual int LoadResource();

	// Get current rectangle to render a frame of sprite.
	RECT* GetCurrentRect(void);

	RECT* GetRealRect(void);

	/* Constructor, Destructor */ 

	// Create new tiled sprite from file with trans-color
	ISprite(LPWSTR, LPDIRECT3DDEVICE9, D3DCOLOR); 

	ISprite(void);
	~ISprite(void);
};

